from django.contrib import admin
from .models import SystemLog, SystemMetrics, QuickAction


@admin.register(SystemLog)
class SystemLogAdmin(admin.ModelAdmin):
    list_display = ('user', 'action', 'content', 'ip_address', 'created_at')
    list_filter = ('action', 'created_at')
    search_fields = ('user__username', 'content')
    readonly_fields = ('created_at',)
    ordering = ('-created_at',)


@admin.register(SystemMetrics)
class SystemMetricsAdmin(admin.ModelAdmin):
    list_display = ('cpu_usage', 'memory_usage', 'disk_usage', 'timestamp')
    list_filter = ('timestamp',)
    readonly_fields = ('timestamp',)
    ordering = ('-timestamp',)


@admin.register(QuickAction)
class QuickActionAdmin(admin.ModelAdmin):
    list_display = ('title', 'description', 'route', 'is_active', 'sort_order')
    list_filter = ('is_active', 'required_permission')
    search_fields = ('title', 'description')
    ordering = ('sort_order', '-created_at')